﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TouristAgencyDBConnection;

namespace TouristAgencyWindowsForm
{
    public partial class FacilitiesForm : Form
    {
        private TouristAgencyDataContext context;

        public FacilitiesForm()
        {
            InitializeComponent();
            this.context = new TouristAgencyDataContext();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            LoadFacilities();
        }

        private void LoadFacilities()
        {
            this.facilityItemBindingSource.DataSource = context.FacilityItems;
        }

        private void buttonSave_Click(object sender, EventArgs e)
        {
            this.context.SubmitChanges();
        }

        private void buttonReload_Click(object sender, EventArgs e)
        {
            LoadFacilities();
        }
    }
}
